/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.peluq.model.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Diego_M
 */
@Entity
@Table(name = "notas_deb_cred", catalog = "peludb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "NotasDebCred.findAll", query = "SELECT n FROM NotasDebCred n"),
    @NamedQuery(name = "NotasDebCred.findByNcrCod", query = "SELECT n FROM NotasDebCred n WHERE n.ncrCod = :ncrCod"),
    @NamedQuery(name = "NotasDebCred.findByTipo", query = "SELECT n FROM NotasDebCred n WHERE n.tipo = :tipo"),
    @NamedQuery(name = "NotasDebCred.findByFecha", query = "SELECT n FROM NotasDebCred n WHERE n.fecha = :fecha"),
    @NamedQuery(name = "NotasDebCred.findByMonto", query = "SELECT n FROM NotasDebCred n WHERE n.monto = :monto"),
    @NamedQuery(name = "NotasDebCred.findByEstado", query = "SELECT n FROM NotasDebCred n WHERE n.estado = :estado")})
public class NotasDebCred implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ncr_cod", nullable = false)
    private Integer ncrCod;
    @Size(max = 30)
    @Column(name = "tipo", length = 30)
    private String tipo;
    @Column(name = "fecha")
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @Column(name = "monto")
    private Integer monto;
    @Column(name = "estado")
    private Integer estado;
    @JoinColumn(name = "Nro_fac", referencedColumnName = "Nro_fac", nullable = false)
    @ManyToOne(optional = false)
    private Facturas nrofac;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "notasDebCred")
    private Collection<DetNtadebCre> detNtadebCreCollection;

    public NotasDebCred() {
    }

    public NotasDebCred(Integer ncrCod) {
        this.ncrCod = ncrCod;
    }

    public Integer getNcrCod() {
        return ncrCod;
    }

    public void setNcrCod(Integer ncrCod) {
        this.ncrCod = ncrCod;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public Integer getMonto() {
        return monto;
    }

    public void setMonto(Integer monto) {
        this.monto = monto;
    }

    public Integer getEstado() {
        return estado;
    }

    public void setEstado(Integer estado) {
        this.estado = estado;
    }

    public Facturas getNrofac() {
        return nrofac;
    }

    public void setNrofac(Facturas nrofac) {
        this.nrofac = nrofac;
    }

    @XmlTransient
    public Collection<DetNtadebCre> getDetNtadebCreCollection() {
        return detNtadebCreCollection;
    }

    public void setDetNtadebCreCollection(Collection<DetNtadebCre> detNtadebCreCollection) {
        this.detNtadebCreCollection = detNtadebCreCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ncrCod != null ? ncrCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof NotasDebCred)) {
            return false;
        }
        NotasDebCred other = (NotasDebCred) object;
        if ((this.ncrCod == null && other.ncrCod != null) || (this.ncrCod != null && !this.ncrCod.equals(other.ncrCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.peluq.model.entity.NotasDebCred[ ncrCod=" + ncrCod + " ]";
    }
    
}
